<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>水质监测(2) - macdfree&#39;s blog</title>
  <meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>

<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">


<meta name="author" content="macd" />
  <meta name="description" content="拖来拖去就拖到现在了，什么都没弄，趁现在临阵抱一下佛脚吧。
" />

  <meta name="keywords" content="blog, macd, even" />


<meta name="baidu-site-verification" content="Ak74Sk61bk" />
<meta name="google-site-verification" content="fAeFHpkrhfFS8LxdzXy0EtAPcVStv0faGn238sRF3L8" />


<meta name="generator" content="Hugo 0.54.0" />


<link rel="canonical" href="/posts/%E6%B0%B4%E8%B4%A8%E7%9B%91%E6%B5%8B2/" />

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">




<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>


<link href="/dist/even.min.css?v=3.1.1" rel="stylesheet">
<link href="/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">




<meta property="og:title" content="水质监测(2)" />
<meta property="og:description" content="拖来拖去就拖到现在了，什么都没弄，趁现在临阵抱一下佛脚吧。" />
<meta property="og:type" content="article" />
<meta property="og:url" content="/posts/%E6%B0%B4%E8%B4%A8%E7%9B%91%E6%B5%8B2/" />
<meta property="article:published_time" content="2014-04-06T00:00:00&#43;00:00"/>
<meta property="article:modified_time" content="2014-04-06T00:00:00&#43;00:00"/>

<meta itemprop="name" content="水质监测(2)">
<meta itemprop="description" content="拖来拖去就拖到现在了，什么都没弄，趁现在临阵抱一下佛脚吧。">


<meta itemprop="datePublished" content="2014-04-06T00:00:00&#43;00:00" />
<meta itemprop="dateModified" content="2014-04-06T00:00:00&#43;00:00" />
<meta itemprop="wordCount" content="672">



<meta itemprop="keywords" content="CC2500," />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="水质监测(2)"/>
<meta name="twitter:description" content="拖来拖去就拖到现在了，什么都没弄，趁现在临阵抱一下佛脚吧。"/>

<!--[if lte IE 9]>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->

<!--[if lt IE 9]>
  <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->

</head>
<body>
  <div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/" class="logo">macdfree&#39;s blog</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>
<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    <a href="/">
        <li class="mobile-menu-item">首页</li>
      </a><a href="/categories/">
        <li class="mobile-menu-item">分类</li>
      </a><a href="/tags/">
        <li class="mobile-menu-item">标签</li>
      </a><a href="/archive/">
        <li class="mobile-menu-item">归档</li>
      </a>
  </ul>
</nav>
  <div class="container" id="mobile-panel">
    <header id="header" class="header">
        <div class="logo-wrapper">
  <a href="/" class="logo">macdfree&#39;s blog</a>
</div>

<nav class="site-navbar">
  <ul id="menu" class="menu">
    <li class="menu-item">
        <a class="menu-item-link" href="/">首页</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/categories/">分类</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/tags/">标签</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/archive/">归档</a>
      </li>
  </ul>
</nav>
    </header>

    <main id="main" class="main">
      <div class="content-wrapper">
        <div id="content" class="content">
          <article class="post">
    
    <header class="post-header">
      <h1 class="post-title">水质监测(2)</h1>

      <div class="post-meta">
        <span class="post-time"> 2014-04-06 </span>
        <div class="post-category">
          
            <a href="/categories/note/"> note </a>
          
        </div>
        <span class="more-meta"> 约 672 字 </span>
        <span class="more-meta"> 预计阅读 2 分钟 </span>
        <span id="busuanzi_container_page_pv" class="more-meta"> <span id="busuanzi_value_page_pv"><img src="/img/spinner.svg" alt="spinner.svg"/></span> 次阅读 </span>
      </div>
    </header>

    
    
<div class="post-toc" id="post-toc">
  <h2 class="post-toc-title">文章目录</h2>
  
  <div class="post-toc-content always-active">
    <nav id="TableOfContents">
<ul>
<li><a href="#1-cc2500模块">1. CC2500模块</a></li>
<li><a href="#2-gprs模块">2. GPRS模块</a></li>
<li><a href="#3-电平适配">3. 电平适配</a></li>
<li><a href="#4-数据库的设计">4. 数据库的设计</a></li>
</ul>
</nav>
  </div>
</div>

    
    <div class="post-content">
      <p>拖来拖去就拖到现在了，什么都没弄，趁现在临阵抱一下佛脚吧。</p>

<h1 id="1-cc2500模块">1. CC2500模块</h1>

<p>用的是现成淘宝买的模块，从它的芯片手册中知道</p>

<blockquote>
<p>CC2500是一种低成本的2.4GHz收发器，集成了一个数据传输率可达500kbps的高度可配置的调制解调器，并为数据包处理、数据缓冲、突发数据传输、清晰信道评估、连接质量指示和电磁波激发提供广泛的硬件支持。</p>
</blockquote>

<p>虽然芯片手册说的好像很厉害的样子，但对我来说完全没感觉，手册后面各种专业术语也根本就是对牛弹琴，对我有用的我想就是这幅图了
<img src="/images/m3.png" alt="CC2500状态转换图" />
上图描述了CC2500工作状态的转换过程，由此编写CC2500的驱动代码。具体的参考<a href="http://www.360doc.com/content/12/0712/13/9688385_223765865.shtml">CC2500使用手记</a></p>

<p>普通节点的CC2500工作流程如下图
<img src="/images/m5.png" alt="普通节点CC2500工作流程" /></p>

<p>另外，CC2500的工作电压为3.3V，与5V单片机电平不匹配，所以要么换成3.3V的单片机，要么加稳压模块将5V转换成3.3V。</p>

<h1 id="2-gprs模块">2. GPRS模块</h1>

<p>GPRS模块现在还没有仔细看，测试过直接和电脑通过串口发送AT指令控制GPRS模块，现在主要的问题是GPRS芯片的工作电压为4V（3.2-4.8）左右，而且需要有2A以上的电流供电能力。</p>

<h1 id="3-电平适配">3. 电平适配</h1>

<p>单片机的选择主要考虑它和外围模块的电平匹配，CC2500模块的工作电压为3.3V，GPRS模块的工作电压为3.2-4.8V，大致的如下图
<img src="/images/m4.png" alt="电平分配" /></p>

<h1 id="4-数据库的设计">4. 数据库的设计</h1>

<table>
<thead>
<tr>
<th>列名</th>
<th>描述</th>
<th>数据类型</th>
<th>允许空值</th>
<th>说明</th>
</tr>
</thead>

<tbody>
<tr>
<td>sensor_ID</td>
<td>节点ID</td>
<td>uniqueidentifier</td>
<td>NO</td>
<td>主键</td>
</tr>

<tr>
<td>PH</td>
<td>ph值</td>
<td>nvarchar(256)</td>
<td>NO</td>
<td>-</td>
</tr>

<tr>
<td>temperature</td>
<td>温度</td>
<td>nvarchar(256)</td>
<td>NO</td>
<td>-</td>
</tr>

<tr>
<td>dissolved_oxygen</td>
<td>溶解氧</td>
<td>nvarchar(256)</td>
<td>NO</td>
<td>-</td>
</tr>

<tr>
<td>update_time</td>
<td>更新时间</td>
<td>datetime</td>
<td>NO</td>
<td>-</td>
</tr>
</tbody>
</table>

<p>上表只是关于节点数据存放的表，一个数据采集节点某一时刻的数据作为一条记录，通过汇聚的GPRS模块发送至服务器，然后由socket程序负责接收处理数据并存入数据库。</p>
    </div>

    
    <div class="post-copyright">
  <p class="copyright-item">
    <span class="item-title">文章作者</span>
    <span class="item-content">macd</span>
  </p>
  <p class="copyright-item">
    <span class="item-title">上次更新</span>
    <span class="item-content">2014-04-06</span>
  </p>
  
  
</div>

    
    
<div class="post-reward">
  <input type="checkbox" name="reward" id="reward" hidden />
  <label class="reward-button" for="reward">赞赏支持</label>
  <div class="qr-code">
    
    
      <label class="qr-code-image" for="reward">
        <img class="image" src="/img/reward/wechat-qr-code.png">
        <span>微信打赏</span>
      </label>
    
      <label class="qr-code-image" for="reward">
        <img class="image" src="/img/reward/alipay-qr-code.png">
        <span>支付宝打赏</span>
      </label>
  </div>
</div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
          <a href="/tags/cc2500/">CC2500</a>
          
        </div>

      
      <nav class="post-nav">
        
          <a class="prev" href="/posts/%E4%B8%B2%E5%8F%A3%E8%BF%9E%E6%8E%A5%E6%A0%91%E8%8E%93%E6%B4%BE/">
            <i class="iconfont icon-left"></i>
            <span class="prev-text nav-default">串口连接树莓派</span>
            <span class="prev-text nav-mobile">上一篇</span>
          </a>
        
          <a class="next" href="/posts/php-apache-mysql%E9%85%8D%E7%BD%AE/">
            <span class="next-text nav-default">php apache mysql配置</span>
            <span class="prev-text nav-mobile">下一篇</span>
            <i class="iconfont icon-right"></i>
          </a>
      </nav>
    </footer>
  </article>
        </div>
        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="social-links">
      <a href="mailto:macdfree@163.com" class="iconfont icon-email" title="email"></a>
      <a href="https://github.com/MACDfree" class="iconfont icon-github" title="github"></a>
  <a href="/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
</div>

<div class="copyright">
  <span class="power-by">
    由 <a class="hexo-link" href="https://gohugo.io">Hugo</a> 强力驱动
  </span>
  <span class="division">|</span>
  <span class="theme-info">
    主题 - 
    <a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a>
  </span>

  <div class="busuanzi-footer">
    <span id="busuanzi_container_site_pv"> 本站总访问量 <span id="busuanzi_value_site_pv"><img src="/img/spinner.svg" alt="spinner.svg"/></span> 次 </span>
    <span class="division">|</span>
    <span id="busuanzi_container_site_uv"> 本站总访客数 <span id="busuanzi_value_site_uv"><img src="/img/spinner.svg" alt="spinner.svg"/></span> 人 </span>
  </div>

  <span class="copyright-year">
    &copy; 
    
      2014 - 
    2019
    <span class="heart">
      <i class="iconfont icon-heart"></i>
    </span>
    <span class="author">macd</span>
    <span class="division">|</span>
    <span style="margin-left: 5px;">
      <img alt="buildstatus" src="https://travis-ci.org/MACDfree/hugoblog.svg?branch=master">
    </span>
  </span>
</div>
    </footer>

    <div class="back-to-top" id="back-to-top">
      <i class="iconfont icon-up"></i>
    </div>
  </div>
  
<script src="/lib/highlight/highlight.pack.js?v=20171001"></script><script type="text/javascript" src="/lib/jquery/jquery-3.2.1.min.js"></script>
  <script type="text/javascript" src="/lib/slideout/slideout-1.0.1.min.js"></script>
  <script type="text/javascript" src="/lib/fancybox/jquery.fancybox-3.1.20.min.js"></script>
<script type="text/javascript" src="/dist/even.min.js?v=3.1.1"></script>








</body>
</html>
